package com.yubest.seataaccount.controller;

import com.yubest.seataaccount.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
@RequestMapping(value = "/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    /**
     * 扣钱
     * @return
     */
    @PostMapping(value = "/sub")
    public Boolean sub(@RequestParam Integer accountId, @RequestParam BigDecimal money) {
        return accountService.sub(accountId, money);
    }
}
